﻿
<%namespace YouHP.Model%>
<%namespace YouHP.Utility%>
<%namespace YouHP.Model.Group%>

<%template _Header%>
<script type="text/javascript">
function loadComments ()
{
//  var query = location.href.substring(location.href.indexOf("?")); 
  var uid=getURLParam("uid", location.href);
  var aurl = "/Pages/alpha/Ajax/CommentListAjax.aspx?uid="+uid+"&page=1";
  var myAjax=new Ajax(aurl,
  {
     method:'get',
     onComplete:function()
     {
      var html=this.response.text;
      _$("commentList").innerHTML=html;
      }
   }
   );
   myAjax.request();
}  

function ViewCommentPage(pageindex)
{
  var query = location.href.substring(location.href.indexOf("?"));
  var aurl = "/Pages/alpha/Ajax/CommentListAjax.aspx"+query+"&page="+pageindex;
  var myAjax=new Ajax(aurl,
  {
     method:'get',
     onComplete:function()
     {
      var html=this.response.text;
      _$("commentList").innerHTML=html;
      }
   }
   );
   myAjax.request();
} 


 
function CommentDelete(id)
{
  var query = location.href.substring(location.href.indexOf("?"));
  var aurl = "/Pages/alpha/Ajax/CommentDeleteAjax.aspx"+query+"&id="+id;
  var myAjax=new Ajax(aurl,
  {
     method:'get',
     onComplete:function()
     {
      var html=this.response.text;
      _$("commentList").innerHTML=html;
      }
   }
   );
   myAjax.request();
  
  
} 


function CommentAdd(toUserId)
{
    var query = location.href.substring(location.href.indexOf("?"));
    var msg = _$("msg").value;
  
    if (msg.length == 0)
    {
        alert("评论内容不能为空！");
        return;
    }
    if(msg.length > 300 ) 
    {
        alert("评论内容不能超过300个字！");
        return;
    }
  var query = location.href.substring(location.href.indexOf("?"));
  var aurl = "/Pages/alpha/Ajax/CommentAddAjax.aspx"+query+"&msg="+msg.escUrl()+"&toUserId="+toUserId;
  var myAjax=new Ajax(aurl,
  {
     method:'post',
     onComplete:function()
     {
              var html=this.response.text;
              _$("commentList").innerHTML=html;
              _$("msg").value="";
      }
   }
   );
   myAjax.request();
  
  
}


function CommentReplyAdd(id,toUserId)
{
    var query = location.href.substring(location.href.indexOf("?"));
    var replycontent = _$("replycontent"+id).value;
      
        if (replycontent.length == 0)
        {
            alert("回复内容不能为空！");
            return;
        }
        if(replycontent.length > 300 ) 
        {
            alert("回复内容不能超过300个字！");
            return;
        }
      
      var aurl = "/Pages/alpha/Ajax/CommentReplyAddAjax.aspx"+query+"&replycontent="+replycontent.escUrl()+"&toUserId="+toUserId+"&parentId="+id;
      var myAjax=new Ajax(aurl,
      {
         method:'get',
         onComplete:function()
         {
           var html=this.response.text;
           _$("commentList").innerHTML=html;
           _$('replycontent'+id).value = "";
           _$('replybox'+id).style.display = 'none';
          }
       }
       );
       myAjax.request();
}

function replyadd(id)
{

      _$('replybox'+id).style.display = 'block';
}
function replycancell(id)
{

      _$('replybox'+id).style.display = 'none';
}

function displayReplyList(id)
{ 

      var e = _$('commentReplyList_'+id).style.display;
      if(e == 'none')
      {
        _$('commentReplyList_'+id).style.display = 'block';
        _$('displaySwitch_'+id).innerHTML = '-收缩';
      }
      else
      {
        _$('commentReplyList_'+id).style.display = 'none';
        _$('displaySwitch_'+id).innerHTML = '+展开';
      }
}


loadComments();
</script>

<div class="layout2-cols2">
    
    <div class="col1">
		<%template _ProfileMenu%>
	</div>
	
	<div class="col2">

	    <div class="box">
	    	<%template _ProfileHeader%>
	    <div id="commentList"  style="margin-top:10px;">
        
                <div style="padding:20px 50px;">
                <%csharp%> TempUrl = "/images/indicator_medium.gif";<%/csharp%>
                <img src="{this.GetResource(TempUrl)}" /><b>正在加载留言……</b>

                </div>

	    </div>     
	    </div>
	    
	     <%csharp%>TempUrl = ModuleCtrl.Header4("commentpost","发表留言",false,false); <%/csharp%>
{TempUrl}
            
            <div class="content">
    
            <%csharp%>if(UserData.Id > 0) { <%/csharp%>
                <%csharp%>TempUrl="/Profile/CommentAdd.aspx?uid="+ProfileData.Id;<%/csharp%>
                    <form id="feedback" name="feedback" method="post" action="{this.GetUrl(TempUrl)}">
                    <div id="plshow">
                    <div class="bor"> 
                    <textarea name="msg" width="80%" cols="80" rows="6" id="msg" class="rev_textarea"></textarea>
                    <br /><font color="#808080">(字数请不要超过300个字)</font>
                    </div>
                    &nbsp;&nbsp;请文明参与讨论，禁止漫骂攻击。
                    <input name="sb" id="submitbutton" type="button" value="马上发表" class="" onClick="CommentAdd({ProfileData.Id});" />
                    </div>
                    </form>    
                 <span id="cmtstate" style="color:Red"></span>
                 <input type="hidden" id="replytoUserId"  name="replytoUserId" value="-1"/>
            
            <%csharp%> } else { <%/csharp%>
            <%csharp%>TempUrl = "/User/Login.aspx"; <%/csharp%>
            <b>我要说两句</b>.... (请在<a href="{this.GetUrl(TempUrl)}"><b style="text-decoration:underline; color:Red;">登录</b></a>后发表意见)
            <%csharp%> } <%/csharp%>
         
             </div>
 <%csharp%>TempUrl = ModuleCtrl.Footer("commentpost"); <%/csharp%>
 {TempUrl}
	    
      
	</div> 
</div>


<%template _footer%>		
